package com.zhima.feignclient;

import com.zhima.dto.CreateOjUserDTO;
import com.zhima.dto.UserDTO;
import com.zhima.dto.UserDTOExtension;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient("oj-user-service")
@RequestMapping("/oj-user/user/feign")
public interface UserFeignClient {
    /**
     * 根据{userName}获得用户认证信息
     *
     * @param userName
     * @return
     */
    @GetMapping("/auth-info/u/{userName}")
    UserDTOExtension authInfoByUserName(@PathVariable("userName") String userName);

    /**
     * 根据{email}获得用户认证信息
     *
     * @param email
     * @return
     */
    @GetMapping("/auth-info/e/{email}")
    UserDTOExtension authInfoByEmail(@PathVariable("email") String email);

    /**
     * 根据{phone}获得用户认证信息
     *
     * @param phone
     * @return
     */
    @GetMapping("/auth-info/p/{phone}")
    UserDTOExtension authInfoByPhone(@PathVariable("phone") String phone);

    /**
     * 根据{userId}获得用户认证信息
     *
     * @param userId
     * @return
     */
    @GetMapping("/{userId}")
    UserDTO basicInfoById(@PathVariable("userId") Long userId);

    /**
     * 创建普通用户
     *
     * @param ojUser
     * @return
     */
    @PostMapping
    UserDTOExtension createPlainUser(@RequestBody CreateOjUserDTO ojUser);
}
